**Figure A5: Gender gaps by year. Marginal Effects evaluated at the yearly mean of competitiveness with shaded 95% confidence intervals**
clear all 
use Clean_data, clear

gen femalexcomp= female * inv_competNOQUOTA

*Dropout*
qui reg dropout female femalexcomp z_GPA i.year  if degree=="M"  & z_GPA!=. & foreign==0, robust 

frame create drop_t4 year or orlb orub Pval
forvalues j=1983/2019{
sum inv_competNOQUOTA if year==`j' & degree=="M"  & z_GPA!=. & foreign==0
scalar Pval`j'=r(mean)
lincom _b[female]+ _b[femalexcomp]*Pval`j' 
frame post drop_t4 (`j') (`r(estimate)') (`r(lb)') (`r(ub)') (Pval`j')
 }
 
frame change drop_t4
isid year, sort
format or %3.2f
format orlb %3.2f
format orub %3.2f
list, noobs clean

twoway (rarea orlb orub year,fcolor(gs6%50) fintensity(inten50) lwidth(none)) ///
 	(line or year, lcolor(black) lwidth(medthick)), /// 
    graphregion(fcolor(white) lcolor(white)) ylab(,nogrid) ///
  ytitle(" Dropout") xtitle(" ",size(small)) ///
    xlabel(1983(6)2019, labsize(small)) yline(0, lcolor(grey) lpattern(shortdash)) legend(off)

graph save "DropoutT4.gph", replace
frame change default 
 
*** Test answered and Test Correct
global z_test z_answered z_test_correct 

foreach x in $z_test {
qui reg `x' female femalexcomp z_GPA i.year  if degree=="M" & test==1 & (year<1987 | year>1988) & GPA!=. & foreign==0 , robust 

frame create `x'_t4 year or orlb orub Pval
forvalues j=1983/2019{
if inlist(`j',1987,1988) continue
sum inv_competNOQUOTA if year==`j' & degree=="M"  & z_GPA!=. & foreign==0
scalar Pval`j'=r(mean)
lincom _b[female]+ _b[femalexcomp]*Pval`j' 
frame post `x'_t4 (`j') (`r(estimate)') (`r(lb)') (`r(ub)') (Pval`j')
 }
 
frame change `x'_t4
isid year, sort
format or %3.2f
format orlb %3.2f
format orub %3.2f
list, noobs clean

twoway (rarea orlb orub year,fcolor(gs6%50) fintensity(inten50) lwidth(none)) ///
 	(line or year, lcolor(black) lwidth(medthick)), /// 
    graphregion(fcolor(white) lcolor(white)) ylab(,nogrid) ///
  ytitle("`x'") xtitle(" ",size(small)) ///
    xlabel(1983(6)2019, labsize(small)) yline(0, lcolor(grey) lpattern(shortdash)) legend(off)
	
graph save "`x'T4.gph", replace
frame change default 
}

*** Test Score,Total Score, Position
global z_notest z_test_points z_total_points position

foreach x in $z_notest {
qui reg `x' female femalexcomp z_GPA i.year  if degree=="M" & test==1 & GPA!=. & foreign==0 , robust 

frame create `x'_t4 year or orlb orub Pval
forvalues j=1983/2019{
if inlist(`j',1987,1988) continue
sum inv_competNOQUOTA if year==`j' & degree=="M"  & z_GPA!=. & foreign==0
scalar Pval`j'=r(mean)
lincom _b[female]+ _b[femalexcomp]*Pval`j' 
frame post `x'_t4 (`j') (`r(estimate)') (`r(lb)') (`r(ub)') (Pval`j')
 }
 
frame change `x'_t4
isid year, sort
format or %3.2f
format orlb %3.2f
format orub %3.2f
list, noobs clean

twoway (rarea orlb orub year,fcolor(gs6%50) fintensity(inten50) lwidth(none)) ///
 	(line or year, lcolor(black) lwidth(medthick)), ///
	    graphregion(fcolor(white) lcolor(white)) ylab(,nogrid) ///
  ytitle("`x'") xtitle(" ",size(small)) ///
    xlabel(1983(6)2019, labsize(small)) yline(0, lcolor(grey) lpattern(shortdash)) legend(off)
	
graph save "`x'T4.gph", replace
frame change default 
}

**COMBINE ALL GRAPHS***
graph combine dropoutT4.gph z_answeredT4.gph z_test_correctT4.gph z_test_pointsT4.gph z_total_pointsT4.gph positionT4.gph, graphregion(color(white)) cols(2) ysize(11.7) xsize(8.3)
